@extends('admin.layout.layout', ['row' => @$page])

@section('contain')


    <div class="portlet">
        <div class="portlet-title">
            <div class="caption">
                <x-portlet-breadcrumb :page="$page"></x-portlet-breadcrumb>
            </div>
            <div class="actions">
            </div>
        </div>

        <form action="/{{ request()->path() }}/../" method="post">
            @csrf
            @method('PUT')
            <h3 class="section_sub_title">{{ ts('baseinformation') }}</h3>
            <table class="table table-s1">
                <tbody>
                {{--<tr>
                    <td style="width: 200px;">{{ ts('DEALERID') }}</td>
                    <td>
                        <input type="text" name="unique_id" value="{{ $data->unique_id }}" readonly class="form-control">
                    </td>
                </tr>--}}
                <tr>
                    <td>{{ ts('companyname') }}</td>
                    <td>
                        <input type="text" name="company_name" value="{{ $data->company_name }}" class="form-control" required>
                    </td>
                </tr>
                <tr>
                    <td>{{ ts('dmmc') }}</td>
                    <td>
                        <input type="text" name="abbr" value="{{ $data->abbr }}" class="form-control" required>
                    </td>
                </tr>
                <tr>
                    <td>{{ ts('jxsjb') }}</td>
                    <td>
                        <select name="mdtype" class="form-control">
                            @foreach(range(1,4) as $v)
                                <option value="{{ $v }}" {{ $v == $data->mdtype ? 'selected' : '' }}>{{ ts('mdtype'.$v) }}</option>
                            @endforeach
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>{{ ts('PHONENUMBER') }}</td>
                    <td>
                        <div class=" input-group custom-control-inline">
                            <div class="input-group-prepend">
                                <select name="extension" class="form-control">
                                    @foreach(\App\Models\PhoneExtension::get(['id', 'phone_ext']) as $v)
                                        <option value="{{ $v->phone_ext }}" {{ $data->extension == $v->phone_ext ? 'selected' : '' }}>{{ $v->phone_ext }}</option>
                                    @endforeach
                                </select>
                            </div>
                            <input type="number" name="phone_number" value="{{ $data->phone_number }}" class="form-control" required>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>{{ ts('DZYX') }}</td>
                    <td>
                        <input type="email" name="email_address" value="{{ $data->email_address }}" class="form-control">
                    </td>
                </tr>
                <tr>
                    <td>{{ ts('status') }}</td>
                    <td>
                        <select name="status" class="form-control">
                            <option value="1" {{ $data->status == 1 ? 'selected' : '' }}>{{ ts('active') }}</option>
                            @if (empty($user_type) || $user_type != 2)
                                <option value="0" {{ $data->status != 1 ? 'selected' : '' }}>{{ ts('deactive') }}</option>
                            @endif
                        </select>
                    </td>
                </tr>
                <tr>
                    <td style="width: 200px;">{{ ts('region') }}</td>
                    <td>
                        <select name="region_id" id="" class="form-control region_json" data-value="{{ $data->region_id }}" required>
                            <option value="">{{ ts('select') }}</option>
                            <option value="{{ $data->region_id }}" selected>{{ ts('region_master.'.$data->region_id) }}</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td style="width: 200px;">{{ ts('province') }}</td>
                    <td>
                        <select name="province_id" id="" class="form-control province_json" data-value="{{ $data->province_id }}" required>
                            <option value="">{{ ts('select') }}</option>
                            <option value="{{ $data->province_id }}" selected>{{ ts('province_master.'.$data->province_id) }}</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td style="width: 200px;">{{ ts('city') }}</td>
                    <td>
                        <select name="city" id="" class="form-control city_json" data-value="{{ $data->city }}" required>
                            <option value="">{{ ts('select') }}</option>
                            <option value="{{ $data->city }}" selected>{{ ts('cities.'.$data->city) }}</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td style="width: 200px;">{{ ts('gsdz') }}</td>
                    <td>
                        <input type="text" name="address" value="{{ $data->address }}" class="form-control">
                    </td>
                </tr>
                </tbody>
            </table>
            <h3 class="section_sub_title">{{ ts('contactInformation') }}</h3>
            <table class="table table-s1">
                <tbody>
                <tr>
                    <td style="width: 200px;">{{ ts('contactperson') }}</td>
                    <td>
                        <input type="text" name="first_name" value="{{ $data->first_name }}" class="form-control" required>
                    </td>
                </tr>
                <tr>
                    <td style="width: 200px;">{{ ts('sjh') }}</td>
                    <td>
                        <input type="number" name="cell_phone" value="{{ $data->cell_phone }}" class="form-control" required>
                    </td>
                </tr>
                <tr>
                    <td style="width: 200px;">{{ ts('WECHATID') }}</td>
                    <td>
                        <input type="text" name="wechat_id" value="{{ $data->wechat_id }}" class="form-control">
                    </td>
                </tr>
                </tbody>
            </table>
            <table class="table table-s1">
                <tbody>
                <tr>
                    <td style="width: 200px;">{{ ts('SUPERIORDISTRIBUTOR') }}</td>
                    <td>
                        <select name="creator_id" class="form-control">
                            @foreach(\App\Models\Admin::where('user_type', 2)->get(['id', 'abbr']) as $v)
                                <option value="{{ $v->id }}" {{ $data->creator_id == $v->id ? 'selected' : '' }}>{{ $v->abbr }}</option>
                            @endforeach
                        </select>
                    </td>
                </tr>
                </tbody>
            </table>
            <h3 class="section_sub_title">{{ ts('explain') }}</h3>

            <div class="mt-3">
                <textarea name="note" id="" class="form-control">{{ @$data->note }}</textarea>
            </div>
            <div class="mt-4">
                <button class="btn btn-info">{{ ts('store') }}</button>
            </div>
        </form>

    </div>


@endsection